A practical introduction
18/02/2026
.git folder that contains all the file historyIt can be:
…still a git repository
87c0c975daf0643d59a01222b312662d347e0bfa87c0c97Can we not make a google docs for code?
The process makes the user decide…
Pull - Modify - Stage - Commit - Push
github.comCommit (with a message)
Push
.gitignore is used to specify files that should not be tracked
.gitignore file*.Rproj on a new line and save file
.gitignoreA practical overview of the repository, in markdown format
Create a new branch called “dev” in your repository
Make some changes to a file (on the dev branch)
Stage, commit, push
Switch between branches (= “checkout”)
library(readxl)
library(ggplot2)
sessions_file <- "example_sessions.csv"
min_sleep_period <- 2 # hours
file_ext <- tolower(file_ext(sessions_file))
if (file_ext == "csv") {
sessions <- read.csv(sessions_file)
} else if (file_ext %in% c("xls", "xlsx")) {
sessions <- read_excel(sessions_file) |>
as.data.frame()
}
sessions <- sessions[sessions['sleep_period'] >= min_sleep_period * 60 * 60, ]
p <- ggplot(sessions, aes(x = .data$night, y = .data$variable, color = .data$color_group)) +
geom_point(size = 5) +
color_scale +
labs(x = NULL, y = variable, color = NULL) +
theme_minimal(base_size = 16) +
theme(axis.text.x = element_text(angle = 45, hjust = 1))
print(p)load_data”, “set_ema_period”Syntax for R functions:
dev branchFunction template:
…commit and push your changes to github
On github, create a pull request to merge dev into main.
…but Microsoft owns GitHub…
…and the Uni’s own GitLab instance! git.ecdf.ed.ac.uk
Find the presentation and help sheets on GitHub: